/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hjt2;

import java.util.Vector;

/**
 *
 * @author julio
 */
public class StackVector<E> implements Stack<E> {

    private Vector<E> data = new Vector<E>();
    
    @Override
    public void push(E item) {
        data.add(item);
    }

    @Override
    public E pop() {
        if(data.size()>0){
            E item = data.lastElement();
            data.remove(data.size()-1);
            return item;
        }
        return null;
    }

    @Override
    public E peek() {
        if(data.size()>0){
            return data.lastElement();
        }
        return null;
    }

    @Override
    public boolean empty() {
        return data.isEmpty();
    }

    @Override
    public int size() {
        return data.size();
    }    
}
